<script setup>
import TestDemo from '@/components/TestDemo.vue'
import { useUserStore } from '@/stores'
/** 在vue3 Composition API中
 * import { useRouter, useRoute } from 'vue-router'
 * 1. 没有 this（为undefined）
 *  获取路由对象 const router = useRouter()
 * 2. 获取路由参数 const route = useRoute()
 */

const userStore = useUserStore()
</script>

<template>
  <router-view></router-view>
  <hr />
  <hr />
  <hr />
  <div>
    我是App
    <test-demo></test-demo>
    <el-button type="primary" @click="$router.push('/home')">跳首页</el-button>
    <el-button>跳列表页</el-button>
  </div>
  <div>
    <p>{{ userStore.token }}</p>
    <el-button @click="userStore.setToken('dw')">登录</el-button>
    <el-button @click="userStore.removeToken">退出</el-button>
  </div>
</template>

<style scoped></style>
